#include<iostream>
#include<stack>
#include<cctype>
using namespace std;

int main() {
    string expr;
    getline(cin, expr);
    stack<int> nums;
    stack<char> ops;
    
    for (int i = 0; i < expr.length(); i++) {
        if (isspace(expr[i])) continue;
        
        if (isdigit(expr[i])) {
            int num = 0;
            while (i < expr.length() && isdigit(expr[i])) {
                num = num * 10 + (expr[i] - '0');
                i++;
            }
            i--;
            nums.push(num);
        } else if (expr[i] == '+' || expr[i] == '*') {
            while (!ops.empty() && ops.top() == '*') {
                int num2 = nums.top(); nums.pop();
                int num1 = nums.top(); nums.pop();
                char op = ops.top(); ops.pop();
                if (op == '+') nums.push(num1 + num2);
                else nums.push(num1 * num2);
            }
            ops.push(expr[i]);
        }
    }
    
    while (!ops.empty()) {
        int num2 = nums.top(); nums.pop();
        int num1 = nums.top(); nums.pop();
        char op = ops.top(); ops.pop();
        if (op == '+') nums.push(num1 + num2);
        else nums.push(num1 * num2);
    }
    
    cout << nums.top() << endl;
    return 0;
}
